import { Component } from '@angular/core';
// import * as $ from 'jquery';
import { ZwpzService } from '../server/zwpz.service';

import { Router, ActivatedRoute } from '@angular/router'

@Component({
  selector: 'app-tab3',
  templateUrl: 'tab3.page.html',
  styleUrls: ['tab3.page.scss']
})
export class Tab3Page {

  private title: string = '云海星';
  private welcomeStr: string;
  private id: number;
  private book: any;
  private name: string;
  private img: string;
  private shortintr: string;
  private mp3url: string;

  myAudio: any;
  myDiv: any;

  constructor(private zwpzk: ZwpzService, private router: Router, private route: ActivatedRoute) {
    this.welcomeStr = '欢迎来到云海星';
    this.initData();
  }

  initData() {
    let that = this;
    this.route.queryParams.subscribe(res => {
      that.id = res.id;
      //查询数据信息
      this.zwpzk.getFreeUp(res.id).subscribe(result => {
        result.data.forEach(element => {
          if (element.ID == res.id) {
            this.book = element;
            this.img = this.book.IMG;
            this.name = this.book.NAME;
            this.shortintr = this.book.SHORTINTR;
            //this.mp3url = this.book.MP3URL;
            this.mp3url = "http:\/\/esun001.oss-cn-beijing.aliyuncs.com\/mp3\/201809\/20180904.mp3";
            console.log(this.book);
          }
        });


      })
    })

  }


}